package com.zlc.common.core.process.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zlc.common.common.service.BaseServiceImpl;
import com.zlc.common.core.process.model.entity.StoneTask;
import com.zlc.common.core.process.mapper.StoneTaskMapper;
import com.zlc.common.core.process.model.vo.StoneTaskVo;
import com.zlc.common.core.process.service.StoneTaskService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.List;

/**
 * @author  zl
 * @date 2023-10-17 
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class StoneTaskServiceImpl extends BaseServiceImpl<StoneTaskMapper, StoneTask, StoneTaskVo> implements StoneTaskService{

    @Override
    public StoneTaskVo getByTaskId(String taskId) {
        LambdaQueryWrapper<StoneTask> wrapper = wrapper()
                .eq(StoneTask::getTaskId, taskId);
        return queryOne(wrapper);
    }

    @Override
    public List<StoneTaskVo> getByProcessInstanceId(String processInstanceId) {
        LambdaQueryWrapper<StoneTask> wrapper = wrapper()
                .eq(StoneTask::getProcessInstanceId, processInstanceId);
        return queryVoList(wrapper);
    }

    @Override
    public List<StoneTaskVo> getByProcessInstanceIds(List<String> processInstanceIds) {
        LambdaQueryWrapper<StoneTask> wrapper = wrapper()
                .in(StoneTask::getProcessInstanceId, processInstanceIds);
        return queryVoList(wrapper);
    }
}
